<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>v-on实例</title>
    <script type="text/javascript" src="../assests/js/vue.js"></script>
</head>
<body>koik 
    <h1>v-on实例</h1>
    <hr>
    <div id="app">
        <p>当前分数：{{ score }}</p>
        <p>
            <button @click="addScore">加分</button>
            <button v-on:click="deduction">减分</button>
            <input type="number" @keyup.32.13="changeScores()" v-model="text">{{ text }}
        </p>
    </div>
    <script type="text/javascript">
        var app = new Vue({
            el:"#app",
            data:{
                score:0,
                text:"",
            },
            methods:{
                addScore:function(){
                    this.score++;
                },
                deduction:function(){
                    this.score--;
                },
                changeScores:function(){
                    this.score += Number(this.text);
                    this.text = "";
                }
            }
        });
    </script>
</body>
</html>